package swordoffer.offer05;

public class IfInputTypeIsString_API {
    public String replaceSpace(String s) {
        StringBuilder res = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (ch == ' ') {
                res.append("%20");
            } else {
                res.append(ch);
            }
        }
        return res.toString();
    }
    /*
        public String replaceSpace(String s) {
            return s.replace(" ", "%20");
        }
     */
}